<HTML><HEAD><TITLE>vs_random_violated(+VS, -Var)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(tentative)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>vs_random_violated(+VS, -Var)</H1>
Retrieve a random violated variable from a varset
<DL>
<DT><EM>VS</EM></DT>
<DD>A varset
</DD>
<DT><EM>Var</EM></DT>
<DD>Tentative variable (output)
</DD>
</DL>
<H2>Description</H2>

	Retrieve a variable from a varset whose violation count is
	nonzero. If there are more than one, a random candidate is returned.
    
<H3>Modes and Determinism</H3><UL>
<LI>vs_random_violated(+, -) is semidet
</UL>
<H3>Fail Conditions</H3>
The varset does not contain a violated variable
<H2>Examples</H2>
<PRE>
    ?- Vars=[A,B,C], tent_set(Vars, [a,b,c]), vs_create(Vars, VS),
       var_inc_violations(A, 2),
       var_inc_violations(C, 1),
       vs_random_violated(VS, Var).
    Vars = [Var{a -&gt; 2}, B{b -&gt; 0}, C{c -&gt; 1}]
    VS = ...
    Var = Var{a -&gt; 2}	% A or C, the result is random!
    Yes (0.00s cpu)
    </PRE>
<H2>See Also</H2>
<A HREF="../../lib/tentative/vs_all_violated-2.html">vs_all_violated / 2</A>, <A HREF="../../lib/tentative/vs_violated-2.html">vs_violated / 2</A>, <A HREF="../../lib/tentative/vs_random_violated_index-2.html">vs_random_violated_index / 2</A>
</BODY></HTML>
